<!DOCTYPE html>
<html lang="en">

<head>
    <title></title>
</head>
<script>
    {
        var a = 10;
        let b = 20; //不能重复声明变量
    }
    const PI = 3.1415926525; //常量的值不能改变,不能不给值


    console.log(a);
    //console.log(b);
    //数组操作

    let [x, y, z] = [3, 4, 5];
    console.log(x, y, z);


    //对象
    let user = { "name": "张三", "age": 20 };

    let { name, age } = user;
    document.write(name + "===" + age + "<br/>")




    // ``1.原样输出里可以2.使用${}表达式 3.还能调方法
    let str = `他的名字是${name},他今年${age}岁了`;
    document.write(str);

    //对象扩展运算符
    //1.对象复制
    let person = { "name": "王五", "age": 22 };
    let copyPerson = { ...person };
    console.log(person, copyPerson);

    //2.合并对象
    let na = { "name": "里斯" }
    let ag = { age: 30 }
    let p2 = { ...na, ...ag }
    console.log(p2)


    //箭头函数
    var f1=function(a){
        return a
    }

    var f2 = m => m

    console.log(f1("f1"))
    console.log(f2("f2"))

</script>

<body>
    <h1>hello vscode</h1>
</body>

</html>